package aybolit.core.objects.model;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import java.io.Serializable;
import java.util.Collection;

/**
 * Created by IntelliJ IDEA.
 * User: Vadim
 * Date: 29.03.13
 * Time: 16:54
 * To change this template use File | Settings | File Templates.
 */
@Entity
public class Diagnosis implements Serializable {
    private int diagnosiId;

    @javax.persistence.Column(name = "diagnosi_id")
    @Id
    public int getDiagnosiId() {
        return diagnosiId;
    }

    public void setDiagnosiId(int diagnosiId) {
        this.diagnosiId = diagnosiId;
    }

    private String name;

    @javax.persistence.Column(name = "name")
    @Basic
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private String note;

    @javax.persistence.Column(name = "note")
    @Basic
    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    private int type;

    @javax.persistence.Column(name = "type")
    @Basic
    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Diagnosis diagnosis = (Diagnosis) o;

        if (diagnosiId != diagnosis.diagnosiId) return false;
        if (type != diagnosis.type) return false;
        if (name != null ? !name.equals(diagnosis.name) : diagnosis.name != null) return false;
        if (note != null ? !note.equals(diagnosis.note) : diagnosis.note != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = diagnosiId;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (note != null ? note.hashCode() : 0);
        result = 31 * result + type;
        return result;
    }

    private Collection<HealingDiagnosis> healingDiagnosisesByDiagnosiId;

    @OneToMany(mappedBy = "diagnosisByDiagnosisId")
    public Collection<HealingDiagnosis> getHealingDiagnosisesByDiagnosiId() {
        return healingDiagnosisesByDiagnosiId;
    }

    public void setHealingDiagnosisesByDiagnosiId(Collection<HealingDiagnosis> healingDiagnosisesByDiagnosiId) {
        this.healingDiagnosisesByDiagnosiId = healingDiagnosisesByDiagnosiId;
    }
}
